package com.net.xpay.core;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.net.common.util.JacksonMapperUtil;
import com.net.shard.config.CommonDatabaseConfiguration;
import com.net.shard.config.ShardDatabaseConfiguration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;


/**
 * @author  on 23/01/2018.
 */
@Configuration
@MapperScan(value = "com.net.xpay.core.dao", sqlSessionFactoryRef = "shardSqlSessionFactory")
@PropertySource(value = "classpath:/xpay-core-config/application-${spring.profiles.active}.properties", encoding="UTF-8")
@Import({CommonDatabaseConfiguration.class, ShardDatabaseConfiguration.class})
public class CoreConfiguration {
    @SuppressWarnings("unchecked")
    @Bean
    public ObjectMapper createObjectMapper() {
        return JacksonMapperUtil.create();
    }
}
